<template>
	<view class="body">
		<view class="card" v-for="(item,index) in userList" @tap="changeUrl(item.name, item.nameType, item.sex)">
			<view class="left_card">
				<image
					:src="item.sex == 1 ? getImgUrl('/img/wshing/nansheng.png') : getImgUrl('/img/wshing/nvsheng.png')"
					mode="" class="img"></image>
				<view class="right_ft">
					<view class="font">
						{{item.name}}
					</view>
					<view class="btn_ft">
						<text>{{item.sex == 1 ? '男' : '女'}}</text>
						<text class="birthday">{{item.birthday}}</text>
					</view>
				</view>
			</view>
			<view class="">
				<uni-icons custom-prefix="right" type="right" size="25"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		glyphomancylist
	} from '@/utils/OnetoOneaApi.js';
	import {
		imgBaseUrl
	} from '@/utils/baseUrl.js'
	export default {
		data() {
			return {
				userList: [],
				pageNo: 1,
				imgs: 'https://img2.baidu.com/it/u=372601434,3534902205&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1698339600&t=4fc588b80994e63f52ba133c683d0a33'
			}
		},
		onReachBottom() {
			this.pageNo+1;
			console.log( this.pageNo++,' this.pageNo++;');
			this.datalist();
			
		},
		onLoad() {
			this.datalist()
		},
		methods: {
			// 测字记录列表
			async datalist() {
				const userInfo = uni.getStorageSync('userInfo')
				const res = await glyphomancylist(userInfo.id,this.pageNo);
				this.userList = [...this.userList, ...res.result.records]
			},
			// 图片渲染
			getImgUrl(image) {
				return imgBaseUrl + image;
			},
			changeUrl(name, nameType, sex) {
				console.log(name,nameType,sex,'=================')
				uni.navigateTo({
				url: `../../../subPackagesA/pages/glyphomancyDetail/glyphomancyDetail?name=${name}&sexVls=${sex}&show=12`
				})
			}
		}
	}
</script>

<style>
page{
	background: #F5F5F5;
}
</style>
<style lang="less" scoped>
	.body {
		width: 100%;
		background: #F5F5F5;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-bottom: 40rpx;
		.card {
			width: 90%;
			height: 168rpx;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			opacity: 1;
			padding: 20rpx 20rpx 20rpx 20rpx;
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.left_card {
				display: flex;
				align-items: center;

				.img {
					width: 104rpx;
					height: 104rpx;
					border-radius: 50%;
				}

				.right_ft {
					margin-left: 20rpx;
					letter-spacing: 2rpx;

					.font {
						font-size: 32rpx;
						font-family: PingFang SC-Bold, PingFang SC;
						font-weight: bold;
						color: #333333;
						line-height: 62rpx;
					}

					.btn_ft {
						font-size: 24rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #666666;

						.birthday {
							margin-left: 10rpx;
						}
					}
				}
			}
		}
	}
</style>